﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleCasino
{
    public class Player
    {
        public string Name { get; private set; }
        public int Money { get; private set; }
        public int Fame { get; private set; }
        public Sex Gender { get; private set; }

        public Player(string name, Sex gender)
        {
            this.Name = name;
            this.Gender = gender;
            this.SetInitialValues();
        }

        public PlayerInput GetInput()
        {
            // Checks if the player has pressed left, right scroll button or Enter and returns that info as PlayerInput enum
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo keyInfo = Console.ReadKey();
                if (keyInfo.Key == ConsoleKey.LeftArrow)
                {
                    return PlayerInput.MoveLeft;
                }
                else if (keyInfo.Key == ConsoleKey.RightArrow)
                {
                    return PlayerInput.MoveRight;
                }
                else if (keyInfo.Key == ConsoleKey.Enter)
                {
                    return PlayerInput.Choose;
                }
                return PlayerInput.Idle;
            }
            return PlayerInput.Idle;
        }
        // Initial values at the start of the game.
        private void SetInitialValues()
        {
            this.Money = 500;
            this.Fame = 0;
        }
    }
}
